package com.sbhotel.chotellauncher.activity;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.sbhotel.chotellauncher.R;


public abstract class BaseActivity extends Activity {

    TextView activityTitle, activityTitleDesc;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(initLayout());

        initView();
        initData();
    }

    public abstract void initView();
    public abstract void initData();
    public abstract int initLayout();
    public void initTitleBar(String title, String desc) {
        activityTitle = findViewById(R.id.activity_title);
        activityTitleDesc = findViewById(R.id.title_desc);
        if(!TextUtils.isEmpty(title)) {
            activityTitle.setText(title);
        }
        if(!TextUtils.isEmpty(desc)) {
            activityTitleDesc.setText(desc);
            activityTitleDesc.setVisibility(View.VISIBLE);
        } else {
            activityTitleDesc.setVisibility(View.GONE);
        }
    }
}
